﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XNodeEditor;
[XNodeEditor.NodeEditor.CustomNodeEditor(typeof(SetNode))]
public class SetEditor : NodeEditor
{
    private SetNode node;
    public override void OnBodyGUI()
    {
        serializedObject.Update();
        if (node == null) node = target as SetNode;

        NodeEditorGUILayout.PortField(target.GetInputPort("upLink"));
        EditorGUILayout.Space();
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("setType"));
        EditorGUIUtility.labelWidth = 115;
        switch (node.setType)
        {
            case SetNode.SetType.ShortcutSetting:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("shortcutTypeList"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("short_bool"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("short_extra"));
                break;
            case SetNode.SetType.IdleTime:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Idle_delay"));
                break;
            case SetNode.SetType.Handle3DCamera:
                break;
            case SetNode.SetType.SetCameraRoot:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_wait"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_recover"));
                if (!node.CamRoot_recover)
                {
                    NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_ins_id"));
                    NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_node"));
                    NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_rotate"));
                    NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("CamRoot_fov"));
                }
                break;
            case SetNode.SetType.UIEffect:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("uiEffect_content"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("uiEffect_pos"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("uiEffect_scale"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("uiEffect_loop"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("uiEffect_last_time"));
                break;
            case SetNode.SetType.PlayBackgroundSound:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("bgSound_mode"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("bgSound_content"));
                break;
            case SetNode.SetType.PlaySoundEffect:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("soundEffect_delay_time"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("sound_content"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("soundEffect_loop"));
                break;
            case SetNode.SetType.SetMapDynamic:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("mapDynamic_width"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("mapDynamic_height"));
                break;
            case SetNode.SetType.SetDynamicArea:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("dynamicArea_target"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("dynamicArea_index"));
                break;
            case SetNode.SetType.SetAnimatorSpeed:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("animatSpeed_target"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("animatSpeed_ins_id"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("animatSpeed_speed"));
                break;
            case SetNode.SetType.SetTimeScale:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("timeScale_mode"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("timeScale_time"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("timeScale_target"));
                break;
            case SetNode.SetType.SetSceneFog:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("sceneFog_start_dis"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("sceneFog_end_dis"));
                break;
        }
        NodeEditorGUILayout.PortField(target.GetOutputPort("downLink"));
        serializedObject.ApplyModifiedProperties();
    }
    public override int GetWidth()
    {
        return 220;
    }
}
